package cn.stormbirds.stpaylib;

import com.alibaba.fastjson.JSONObject;

import cn.stormbirds.stpaylib.handler.AliPayHandler;
import cn.stormbirds.stpaylib.handler.BasePayHandler;
import cn.stormbirds.stpaylib.handler.UnionPayHandler;
import cn.stormbirds.stpaylib.handler.WxPayHandler;

import static cn.stormbirds.stpaylib.bean.STPayCodes.*;

/**
 * Copyright (c) 小宝 @2019
 *
 * @ Package Name:    cn.stormbirds.stpaylib
 * @author         stormbirds
 * @ Email：          xbaojun@gmail.com
 * @ Created At：     2019/6/25 09:38
 * @ Description：
 */


public enum PayType {
    /**
     * 微信支付
     */
    wxPay {
        @Override
        public BasePayHandler getPayService(STPayCallback callback, JSONObject preOreder) {
            return new WxPayHandler(callback, preOreder);
        }

        @Override
        public int getChannelCode() {
            return CHANNEL_WXPAY;
        }
    },
    /**
     * 阿里支付
     */
    aliPay {
        @Override
        public BasePayHandler getPayService(STPayCallback callback, JSONObject preOreder) {
            return new AliPayHandler(callback, preOreder);
        }

        @Override
        public int getChannelCode() {
            return CHANNEL_ALIPAY;
        }
    },
    /**
     * 贝宝支付
     */
    paypalPay{
        @Override
        public BasePayHandler getPayService(STPayCallback callback, JSONObject preOreder) {
            return null;
        }

        @Override
        public int getChannelCode() {
            return CHANNEL_PAYPALPAY;
        }
    },
    /**
     * 银联支付
     */
    unionPay{
        @Override
        public BasePayHandler getPayService(STPayCallback callback, JSONObject preOreder) {
            return new UnionPayHandler(callback,preOreder);
        }

        @Override
        public int getChannelCode() {
            return CHANNEL_UNIONPAY;
        }
    },
    /**
     * 富友支付
     */
    fuiouPay{
        @Override
        public BasePayHandler getPayService(STPayCallback callback, JSONObject preOreder) {
            return null;
        }

        @Override
        public int getChannelCode() {
            return CHANNEL_FUIOUPAY;
        }
    },
    /**
     * 派安盈支付
     */
    payoneerPay{
        @Override
        public BasePayHandler getPayService(STPayCallback callback, JSONObject preOreder) {
            return null;
        }

        @Override
        public int getChannelCode() {
            return CHANNEL_PAYONEERPAY;
        }
    },
    /**
     * 微信友店支付
     */
    wxYouDianPay{
        @Override
        public BasePayHandler getPayService(STPayCallback callback, JSONObject preOreder) {
            return null;
        }

        @Override
        public int getChannelCode() {
            return CHANNEL_WXYOUDIANPAY;
        }
    };

    public abstract BasePayHandler getPayService(STPayCallback callback, JSONObject preOreder);

    public abstract int getChannelCode();
}
